package com.xin.demo.strategy;

import java.io.Serializable;

public class Cat implements Serializable {
    public final int weight;
    public final int height;

    public int compareToHeight(Cat cat) {
        return this.weight - cat.weight;
    }

    // 此处为新增加的 根据体重进行比较的方法
    public int compareToWeight(Cat cat) {
        return this.weight - cat.weight;
    }

    public Cat(int weight, int height) {
        this.weight = weight;
        this.height = height;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "weight=" + weight +
                ", height=" + height +
                '}';
    }
}
